package me.zhengjie.repository;

import me.zhengjie.dto.sqlServer.ProductionStation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface ProductionStationRepository extends JpaRepository<ProductionStation, Integer>, JpaSpecificationExecutor<ProductionStation> {

    ProductionStation findProductionStationById(Integer stationId);

    @Query("SELECT p FROM ProductionStation p WHERE p.stationCode = ?1")
    ProductionStation findProductionStationByStationCode(String stationCode);

    @Modifying
    @Query("update ProductionStation ps set ps.processcardId=?1 , ps.userName=?2 where ps.id=?3")
    void updateProductionStationById(Integer processcardId, String userName, Integer id);
}
